//
//  GMSecondViewCell.m
//  StockSystem
//
//  Created by 小熊 on 2018/6/21.
//  Copyright © 2018年 小熊. All rights reserved.
//

#import "GMSecondViewCell.h"
#import "GMHomeTableViewCell.h"
@interface GMSecondViewCell ()<UITableViewDataSource,UITableViewDelegate>
@property (weak, nonatomic) IBOutlet UITableView *tabView;
@property (weak, nonatomic) IBOutlet UIButton *learBtn;
@property (weak, nonatomic) IBOutlet UIButton *groupBtn;
@property (weak, nonatomic) IBOutlet UIButton *rankBtn;

@end
@implementation GMSecondViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    [self.tabView registerNib:[UINib nibWithNibName:@"GMHomeTableViewCell" bundle:nil] forCellReuseIdentifier:@"GMHomeTableViewCell"];
    self.tabView.dataSource = self;
    self.tabView.delegate = self;
    self.learBtn.selected =YES;
    self.learBtn.backgroundColor =[UIColor colorWithHexString:@"0C75E8"];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

    GMHomeTableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:@"GMHomeTableViewCell" forIndexPath:indexPath];
    return cell;
    
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 100;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 4;
}
-                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{

    if (self.delegate && [self.delegate respondsToSelector:@selector(cellSelectedWithIndex:)]) {
        [self.delegate cellSelectedWithIndex:indexPath.row];
    }
}
- (IBAction)searchBtnClick:(id)sender {
    
    if (self.delegate && [self.delegate respondsToSelector:@selector(searchBtnClick)]) {
        [self.delegate searchBtnClick];
    }
       
}
- (IBAction)learBtnClick:(UIButton *)sender {
    sender.selected =YES;
    sender.backgroundColor =[UIColor colorWithHexString:@"0C75E8"];
    self.groupBtn.selected = NO;
    self.groupBtn.backgroundColor  =kWhiteColor;
    self.rankBtn.selected = NO;
    self.rankBtn.backgroundColor = kWhiteColor;
   
}
- (IBAction)groupBtnClick:(UIButton *)sender {
    sender.selected =YES;
    sender.backgroundColor =[UIColor colorWithHexString:@"0C75E8"];
    self.learBtn.selected = NO;
    self.learBtn.backgroundColor = kWhiteColor;
    self.rankBtn.selected = NO;
    self.rankBtn.backgroundColor =kWhiteColor;
}
- (IBAction)rankBtnClick:(UIButton *)sender {
    sender.selected =YES;
    sender.backgroundColor =[UIColor colorWithHexString:@"0C75E8"];
    self.groupBtn.selected = NO;
    self.groupBtn.backgroundColor = kWhiteColor;
    self.learBtn.selected = NO;
    self.learBtn.backgroundColor =kWhiteColor;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
